# -*- coding:utf-8 -*-

import allure
import os
import pytest
def plus(num1, num2):
    return num1 + num2

def data():
    data = open('data.csv', 'r')
    data = data.read()
    l_data = data.split()
    r_data = l_data[1:]
    list = []
    for line in r_data:
        line2 = line.split(',')
        num1 = int(line2[0])
        num2 = int(line2[1])
        result = int(line2[2])
        tup = {'num1': num1, 'num2': num2, 'result': result}
        list.append(tup)
    return list

@allure.feature('验证data数据')
@pytest.mark.parametrize("tup", data())
def test(tup):
        assert plus(tup['num1'], tup['num2']) == tup['result']

if __name__ == '__main__':
    pytest.main(['--alluredir','./test'])
    os.system('allure generate ./test -o ./report --clean')



